package org.dydl.dao.system.repository;

import org.dydl.model.system.SysUser;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

@Repository
public interface ISysUserRepository extends CrudRepository<SysUser, Long>, JpaSpecificationExecutor<SysUser> {

	@Query(value = " FROM SysUser sy ", countQuery = "SELECT count(sy.id) FROM SysUser sy")
	public Page<SysUser> getSysUserList(Pageable pageable);

	@Query(value = " FROM SysUser sy WHERE sy.userName LIKE :userName", countQuery = "SELECT count(sy.id) FROM SysUser sy WHERE sy.userName LIKE :userName")
	public Page<SysUser> getSysUserListLike(@Param("userName") String userName, Pageable pageable);
}
